package com.example.controller;

import com.example.pojo.CoachComment;
import com.example.service.CoachCommentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/coachComment")
public class CoachCommentController {
    @Autowired
    private CoachCommentService coachCommentService;
    @GetMapping("/getOneById")
    public CoachComment selectCoachCommentById(int id){
        return coachCommentService.selectCoachCommentById(id);
    }
    @GetMapping("/getByCid")
    public List<CoachComment> selectCoachCommentByCid(int cid){
        return coachCommentService.selectCoachCommentByCid(cid);
    }
    @GetMapping("/getAll")
    public List<CoachComment> selectAll(){
        return coachCommentService.selectAll();
    }
    @PostMapping("/insert")
    public int insertCoachComment(int uid,int cid,String comment,String time){
        return coachCommentService.insertCoachComment( uid, cid, comment, time);
    }
    @PostMapping("/deleteById")
    public int deleteCoachCommentById(int id){
        return coachCommentService.deleteCoachCommentById(id);
    }
    @PostMapping("update")
    public int updateCoachComment(int uid,int cid,String comment,String time){
        return coachCommentService.updateCoachComment( uid, cid, comment, time);
    }
}
